home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / RCS / mkmf.bigcmd,v < prev    next >
Encoding:
Text File  |  1992-06-10  |  6.4 KB  |  305 lines

  1. head     1.9;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.9
  10. date     92.06.10.13.04.45;  author jhh;  state Exp;
  11. branches ;
  12. next     1.8;
  13.  
  14. 1.8
  15. date     91.04.11.12.53.35;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.7;
  18.  
  19. 1.7
  20. date     89.10.09.21.28.40;  author rab;  state Exp;
  21. branches ;
  22. next     1.6;
  23.  
  24. 1.6
  25. date     89.08.18.11.21.52;  author douglis;  state Exp;
  26. branches ;
  27. next     1.5;
  28.  
  29. 1.5
  30. date     89.08.17.11.16.14;  author douglis;  state Exp;
  31. branches ;
  32. next     1.4;
  33.  
  34. 1.4
  35. date     89.04.06.21.40.41;  author jhh;  state Exp;
  36. branches ;
  37. next     1.3;
  38.  
  39. 1.3
  40. date     88.11.27.16.28.54;  author ouster;  state Exp;
  41. branches ;
  42. next     1.2;
  43.  
  44. 1.2
  45. date     88.10.13.10.08.59;  author ouster;  state Exp;
  46. branches ;
  47. next     1.1;
  48.  
  49. 1.1
  50. date     88.09.01.15.34.02;  author ouster;  state Exp;
  51. branches ;
  52. next     ;
  53.  
  54.  
  55. desc
  56. @@
  57.  
  58.  
  59. 1.9
  60. log
  61. @make sure all makefiles include TYPE
  62. @
  63. text
  64. @#!/sprite/cmds/csh -f
  65. #
  66. # A script to generate (or regenerate) a Makefile for one subdirectory
  67. # of a command whose sources are spread across many subdirectories.
  68. #
  69. # This script is invoked from mkmf.  See the mkmf manual page for
  70. # details on how mkmf works.
  71. #
  72. # Parameters passed in from mkmf as environment variables:
  73. #    DOMACHINES    names of machines we are supposed to run mkmf on
  74. #    MKMFDIR        directory containing prototype makefiles
  75. #    MKMFFLAGS    arguments to all mkmfs run recursively
  76. #    MACHINES    list of machine names (e.g. "sun2 sun3"), for
  77. #            which there are machine-specific subdirectories
  78. #            (sun2.md, sun3.md) to hold the object files and
  79. #            any machine-specific source files to use when
  80. #            compiling for that machine
  81. #    MAKEFILE    name of makefile to create
  82. #    SUBTYPE        information about the type makefile
  83. #
  84. # Several of these environment variables must be copied to local shell
  85. # variables before use, because shell variables can be used in some places
  86. # where environment variables can't.
  87. #            
  88. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.8 91/04/11 12:53:35 kupfer Exp Locker: jhh $ (SPRITE) Berkeley
  89. #
  90.  
  91. #
  92. # Argument processing.  (Generalized form, even though just one flag so far.)
  93. #
  94. while ($#argv >= 1)
  95.     if ("$1" == '-x') then
  96.     set echo
  97.     endif
  98.     shift
  99. end
  100.  
  101. set subtype=$SUBTYPE
  102. set module=$cwd:t
  103. set pref='[a-z_A-Z]'
  104. set machines=($MACHINES)
  105. set domachines = ($DOMACHINES)
  106. set makefile=$MAKEFILE
  107. set distdir=($DISTDIR)
  108. if (-e $makefile.proto) then
  109.     set proto=$makefile.proto
  110. else
  111.     set proto="${MKMFDIR}/Makefile.bigcmd"
  112. endif
  113.  
  114. echo "Generating $makefile for module $module from $proto"
  115.  
  116. set nonomatch
  117. set allSrcs =( ${pref}*.[cylsp] )
  118. #
  119. # Check to see if there were any sources.  The first check (size == 1)
  120. # is only necessary because the second check will cause an error if
  121. # allSrcs contains more than 1024 bytes.
  122. #
  123. if ($#allSrcs == 1) then
  124.     if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
  125. endif
  126. set mdsrcs =( *.md/${pref}*.[cylsp] )
  127. if ($#mdsrcs == 1) then
  128.     if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
  129. endif
  130. set allSrcs=($allSrcs $mdsrcs)
  131. unset nonomatch
  132.  
  133. #
  134. # Use sed to substitute various interesting things into the prototype
  135. # makefile. The code below is a bit tricky because some of the variables
  136. # being substituted in can be very long:  if the substitution is passed
  137. # to sed with "-e", the entire variable must fit in a single shell argument,
  138. # with a limit of 1024 characters.  By generating a separate script file
  139. # for the very long variables, the variables get passed through (to the
  140. # script file) as many arguments, which gets around the length problem.
  141. #
  142.  
  143. rm -f mkmf.tmp.sed
  144. echo s,"@@(ALLSRCS)",$allSrcs,g > mkmf.tmp.sed
  145. cat $proto | sed -f mkmf.tmp.sed \
  146.     -e "s,@@(DATE),`date`,g" \
  147.     -e "s,@@(MACHINES),$machines,g" \
  148.     -e "s,@@(MAKEFILE),$makefile,g" \
  149.     -e "s,@@(NAME),$module,g" \
  150.     -e "s,@@(TEMPLATE),$proto,g" \
  151.     -e "s,@@(DISTDIR),$distdir,g" \
  152.     -e "s,@@(TYPE),$subtype,g" \
  153.     > $makefile
  154. rm -f mkmf.tmp.sed
  155.  
  156. setenv PARENTDIR $cwd
  157. foreach i ($domachines)
  158.     (cd $i.md; mkmf $MKMFFLAGS -f md.mk; mv md.mk md.mk.tmp; sed -e "s| $i\.md/linked\.o||g" md.mk.tmp > md.mk; rm -f md.mk.tmp)
  159. end
  160. @
  161.  
  162.  
  163. 1.8
  164. log
  165. @Flush DEFTARGET: the default target is now determined by a pmake
  166. library file.
  167. @
  168. text
  169. @d19 1
  170. d25 1
  171. a25 1
  172. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.7 89/10/09 21:28:40 rab Exp Locker: kupfer $ (SPRITE) Berkeley
  173. d38 1
  174. d89 1
  175. @
  176.  
  177.  
  178. 1.7
  179. log
  180. @Modifications for distribution.
  181. @
  182. text
  183. @a9 1
  184. #    DEFTARGET    name of default target
  185. d24 1
  186. a24 1
  187. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.6 89/08/18 11:21:52 douglis Exp Locker: rab $ (SPRITE) Berkeley
  188. a41 1
  189. set defTarget=($DEFTARGET)
  190. a81 1
  191.     -e "s,@@(DEFTARGET),${defTarget:q},g" \
  192. @
  193.  
  194.  
  195. 1.6
  196. log
  197. @another change for TM -- use single machine if it exists, else \ds3100
  198. @
  199. text
  200. @d25 1
  201. a25 1
  202. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.4 89/04/06 21:40:41 jhh Exp Locker: douglis $ (SPRITE) Berkeley
  203. d44 1
  204. a44 1
  205.  
  206. d89 1
  207. @
  208.  
  209.  
  210. 1.5
  211. log
  212. @removed DEFTARGET -- we use $MACHINE now
  213. @
  214. text
  215. @d10 1
  216. d43 1
  217. d84 1
  218. @
  219.  
  220.  
  221. 1.4
  222. log
  223. @added abilty to make specific machine types
  224. @
  225. text
  226. @a9 1
  227. #    DEFTARGET    name of default target
  228. d24 1
  229. a24 1
  230. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.3 88/11/27 16:28:54 ouster Exp $ (SPRITE) Berkeley
  231. a41 1
  232. set defTarget=($DEFTARGET)
  233. a81 1
  234.     -e "s,@@(DEFTARGET),$defTarget,g" \
  235. @
  236.  
  237.  
  238. 1.3
  239. log
  240. @Various changes to replace old C library entirely with new C library.
  241. @
  242. text
  243. @d10 2
  244. d25 1
  245. a25 1
  246. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.2 88/10/13 10:08:59 ouster Exp $ (SPRITE) Berkeley
  247. d41 1
  248. d43 1
  249. a52 6
  250. if (" $machines " =~ *\ sun3\ *) then
  251.     set defTarget=sun3
  252. else
  253.     set defTarget=$machines[1]
  254. endif
  255.  
  256. d92 2
  257. a93 1
  258. foreach i ($machines)
  259. @
  260.  
  261.  
  262. 1.2
  263. log
  264. @Must removed "linked.o" from OBJ list to prevent circular pmake
  265. dependency.
  266. @
  267. text
  268. @d18 4
  269. d23 1
  270. a23 8
  271. # Variables generated here:
  272. #    module        module to create (directories are assumed to be named
  273. #            after the modules they create)
  274. #    pref        prefix pattern that files must match to be included
  275. #    makefile    name of the makefile to create
  276. #    proto        name of prototype makefile to use to create $makefile
  277. #    machines    variable equivalent to MACHINES;  needed because env
  278. #            variables can't always be used where variables can.
  279. a24 2
  280. # $Header: /sprite/lib/mkmf/RCS/mkmf.bigcmd,v 1.1 88/09/01 15:34:02 ouster Exp Locker: ouster $ (SPRITE) Berkeley
  281. #
  282. d85 2
  283. a86 1
  284.     -e "s,@@(MODULE),$module,g" \
  285. a87 1
  286.     -e "s,@@(DEFTARGET),$defTarget,g" \
  287. d89 1
  288. a90 1
  289.     -e "s,@@(DATE),`date`,g" \
  290. @
  291.  
  292.  
  293. 1.1
  294. log
  295. @Initial revision
  296. @
  297. text
  298. @d28 1
  299. a28 1
  300. # $Header: mkmf.kernel,v 1.13 88/08/12 14:38:25 ouster Exp $ (SPRITE) Berkeley
  301. d100 1
  302. a100 1
  303.     (cd $i.md; mkmf $MKMFFLAGS -f md.mk)
  304. @
  305.